﻿using Microsoft.AspNet.SignalR;
using Newtonsoft.Json;
using OASystem.BLL;
using OASystem.BLL.IService;
using OASystem.BLL.Service;
using OASystem.Common;
using OASystem.Model;
using OASystem.Models;
using OASystem.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Security.Claims;
using System.Web;
using System.Web.Mvc;
/// <summary>
/// 通知及添加页简单操作
/// </summary>
namespace OASystem.Controllers
{
    public class DepartIdController : Controller
    {
        public static Announcement user;

        /// <summary>
        /// 用户注入_DepartIdService
        /// </summary>
        #region 用户注入_DepartIdService
        private IDepartIdService  _DepartIdService;
        public DepartIdController(IDepartIdService DepartIdService)
        {
            _DepartIdService = DepartIdService;
        }
        #endregion
        /// <summary>
        /// 查看所属部门下的所有人
        /// </summary>
        /// <returns></returns>
        #region 查看所属部门下的所有人
        public JsonResult UserInfoByDepartId(int departId)
        {
            //Lambda表达式查看所属部门下的所有人
            Expression<Func<Userinfo, bool>> whereLambda = a => a.DepartId == departId;
            //接收集合部门表
            List<Userinfo> departinfos = _DepartIdService.QueryList(whereLambda);
            //提交到前台处理
            return Json(departinfos);
        } 
        #endregion
    }

}